package com.wj.crm.controller;

import com.wj.crm.base.BaseController;
import com.wj.crm.query.CustomerContactQuery;
import com.wj.crm.query.CustomerLinkmanQuery;
import com.wj.crm.service.CustomerContactService;
import com.wj.crm.service.CustomerLinkmanService;
import com.wj.crm.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @author WangJin
 * @version 1.0
 * @date 2022/2/10 18:21
 */
@Controller
@RequestMapping("customer_linkman")
public class CustomerLinkmanController extends BaseController {
    @Autowired
    private CustomerLinkmanService customerLinkmanService;

    @Autowired
    private CustomerService customerService;


    @RequestMapping("list")
    @ResponseBody
    public Map<String,Object> queryCustomerContactByParams(CustomerLinkmanQuery customerLinkmanQuery){

        return customerLinkmanService.queryCustomerContactByParams(customerLinkmanQuery);
    }


    @RequestMapping("toCustomerLinkmanPage")
    public String toCustomerLinkmanPage(Integer cusId, Model model){

        model.addAttribute("customer",customerService.selectByPrimaryKey(cusId));
        model.addAttribute("customerLinkman",customerLinkmanService.selectByPrimaryKey(cusId));
        return "customer/customer_linkman";
    }
}
